import axios from 'axios'
// import config from './config'

export function basePOST (api, params) {
  return axios({
    method: 'post',
    url: api,
    headers: {
      'content-Type': 'application/json'
    },
    data: JSON.stringify(params)
  }).then(res => {
    return res.data
  }).catch(() => {
    // store.dispatch('admin/reLogin')
  })
}
export function baseDETELE (api) {
  return axios({
    method: 'delete',
    url: api
  }).then(res => {
    return res.data
  }).catch(() => {
    // store.dispatch('admin/reLogin')
  })
}

export function baseGET (api, params) {
  return axios({
    method: 'get',
    url: api,
    params: {
      ...params
    }
  }).then(res => res.data)
}
